<template>
  <div class="managing-members">
    <div class="popup">
      <div class="head-title">
        <span v-if="type == 1">管理成员</span>
        <span v-if="type == 2">互动人员</span>
        <span v-if="type == 3">在线人员</span>
        <img
          @click="closeManagingMembersPopup"
          src="@/assets/img/trtc/icon-delete.svg"
          alt=""
        />
      </div>
      <!-- 搜索成员的input框 -->
      <div class="soso">
        <el-input
          prefix-icon="el-icon-search"
          v-model="input"
          size="small"
          placeholder="搜索成员"
        ></el-input>
      </div>
      <!-- 用户列表 -->
      <div class="centent">
        <!-- 讲师 -->
        <div class="lecturer">
          <div class="title" v-if="type != 3">
            <div class="icon"></div>
            <div class="text">讲师</div>
          </div>
          <div class="body" v-if="lecturerList && lecturerList.length > 0">
            <div
              v-for="(item, index) in lecturerList"
              :key="index"
              class="list"
            >
              <membersBox
                :type="type"
                :userInfo="item"
                :index="index"
                :maxIndex="lecturerList.length"
                :userRole="lecturer"
              ></membersBox>
            </div>
          </div>
        </div>
        <!-- 互动观众 -->
        <div class="interactive-audience">
          <div class="title">
            <div class="icon"></div>
            <div class="text" v-if="type == 1 || type == 2">互动观众</div>
            <div class="text" v-else>互动参会</div>
          </div>
          <div
            class="body"
            v-if="interactionList && interactionList.length > 0"
          >
            <div
              v-for="(item, index) in interactionList"
              :key="index"
              class="list"
            >
              <membersBox
                :type="type"
                :userInfo="item"
                :index="index"
                :maxIndex="interactionList.length"
                :userRole="lnteractiveAudience"
              ></membersBox>
            </div>
          </div>
        </div>
        <!-- 观看模式 -->
        <div class="audience" v-if="type == 3">
          <div class="title">
            <div class="icon"></div>
            <div class="text">普通参会</div>
          </div>
          <div class="body" v-if="audienceList && audienceList.length > 0">
            <div
              v-for="(item, index) in audienceList"
              :key="index"
              class="list"
            >
              <membersBox
                :type="type"
                :userInfo="item"
                :index="index"
                :maxIndex="audienceList.length"
                :userRole="lnteractiveAudience"
              ></membersBox>
            </div>
          </div>
        </div>
      </div>
      <!-- 底部操作 -->
      <div v-if="type && type != 3" class="bottom">
        <div class="left">
          <div class="icon">
            <img src="@/assets/img/trtc/icon-personnel.png" alt="" />
          </div>
          <div class="text">
            <span>当前互动人数：</span>
            <span class="red">3</span><span>/12</span>
            人
          </div>
        </div>
        <div class="right" v-if="type == 2">
          <div class="save-button button mar-right">保存并生效</div>
          <div @click="closeManagingMembersPopup" class="close button">
            取消
          </div>
        </div>
        <div class="right" v-if="type == 1">
          <div class="close button mar-right">全员静音</div>
          <div class="save-button button">收回主讲权限</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import membersBox from "./membersBox";
export default {
  props: {
    lecturerList: {
      type: Array,
      default: [],
    },
    interactionList: {
      type: Array,
      default: [],
    },
    audienceList: {
      type: Array,
      default: [],
    },
    // 1:从管理成员进来,2:导播布局进来,3:从总人数进来
    type: {
      type: Number,
      default: 0,
    },
  },
  components: {
    membersBox,
  },
  data() {
    return {
      input: "",
      lecturer: "lecturer", //讲师
      lnteractiveAudience: "lnteractiveAudience", //互动观众
    };
  },
  computed: {},
  mounted() {},
  methods: {
    closeManagingMembersPopup() {
      this.$emit("closeManagingMembersPopup");
    },
  },
};
</script>

<style scoped lang="scss">
.managing-members {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 101;
  display: flex;
  justify-content: center;
  align-items: center;
  .popup {
    height: 650px;
    width: 550px;
    background: #ffffff;
    padding: 20px 0px;
    box-sizing: border-box;
    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: solid 1px #ffffff;
    display: flex;
    flex-direction: column;
    .head-title {
      text-align: center;
      font-size: 16px;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.85);
      position: relative;
      line-height: 22px;
      margin: 0px 20px;
      box-sizing: border-box;
      img {
        width: 17.8px;
        position: absolute;
        right: 0;
        top: 0;
        height: 17.8px;
        cursor: pointer;
      }
    }
    .soso {
      padding: 0 20px;
      margin-top: 12px;
      .el-input {
      }
    }
    .centent {
      flex: 2;
      overflow-y: auto;
      margin: 20px 0;
      margin-bottom: 0;
      .lecturer,
      .interactive-audience,
      .audience {
        margin-top: 20px;
        .title {
          padding: 0 20px;
          display: flex;
          align-items: center;
          margin-bottom: 12px;
          .icon {
            width: 3px;
            height: 14px;
            background: #475aa7;
            border-radius: 2px;
            margin-right: 8px;
          }
          .text {
            font-size: 14px;
            font-weight: 400;
            color: rgba(0, 0, 0, 0.65);
            line-height: 24px;
            margin-right: 8px;
          }
          .tips {
            cursor: pointer;
            font-size: 12px;
            font-weight: 400;
            color: #e94642;
          }
        }
        .body {
        }
      }

      .lecturer {
        margin-top: 0;
      }
    }
    .bottom {
      margin-top: 20px;
      order: 2;
      padding: 0 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left {
        display: flex;
        align-items: center;
        .icon img {
          width: 15px;
          height: 12px;
          margin-right: 12px;
        }
        .text {
          height: 16px;
          font-size: 11px;
          font-weight: 400;
          color: rgba(0, 0, 0, 0.65);
          line-height: 16px;
          .red {
            color: red;
          }
        }
      }
      .right {
        display: flex;
        align-items: center;
        .button {
          cursor: pointer;
          height: 30px;
          line-height: 30px;
          width: 110px;
          font-size: 13px;
          text-align: center;
          font-weight: 400;
          box-sizing: border-box;
        }
        .mar-right {
          margin-right: 20px;
        }
        .save-button {
          background: #475aa7;
          color: #ffffff;
        }
        .close {
          border: 1px solid #d9d9d9;
          background: #fff;
          color: rgba(0, 0, 0, 0.65);
        }
      }
    }
  }
}
</style>
